package designPattern.composite;

import java.util.ArrayList;
import java.util.List;

public class Folder implements Root {

	private String name;
	private List<Root> folder;
	
	public Folder(String name){
		this.name=name;
		this.folder=new ArrayList<Root>();
	}
	@Override
	public boolean addFile(Root file) {
		return  folder.add(file);
	}

	@Override
	public void display() {
		System.out.println(name);
		for (Root f : folder) {
			if (f instanceof Folder) {
				System.out.print("|__");
			}
			f.display();
		}
	}

	@Override
	public List<Root> getFile() {
		return folder;
	}

	@Override
	public boolean removeFile(Root file) {
		return  folder.remove(file);
	}

}
